package com.xr.wage.pay;

import com.bstek.dorado.common.*;
import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.DBStatement;
import com.bstek.dorado.view.*;
import com.bstek.dorado.view.data.*;
import com.bstek.dorado.view.control.*;
import com.xr.common.CommUtil;

/**
 * monthCheckOutViewModel
 */
public class monthCheckOutViewModel extends DefaultViewModel {
  protected void doUpdateData(ParameterSet parameters, ParameterSet outParameters)
      throws Exception {
    // Add your code here
    super.doUpdateData(parameters, outParameters);
  }
  public void checkOut(ParameterSet parameters, ParameterSet outParameters)
  throws Exception {
	  DBStatement dbs = new DBStatement();
	  Dataset ds = getDataset("datasetMonth");
	  if(ds.getInt("IF_CHECKOUT")==1){
		  dbs.setSql("update wa_month_checkout set if_checkout=0,cancel_check_date=sysdate,cancel_check_man="+CommUtil.getEmployeeId()+" where month='"+ds.getString("month")+"'");
		  dbs.execute();
	  }else{
		  dbs.setSql("update wa_month_checkout set if_checkout=1,check_date=sysdate,check_man="+CommUtil.getEmployeeId()+" where month='"+ds.getString("month")+"'");
		  dbs.execute();
	  }
	  dbs.close();
}
}
